const r1=1
const r2=2
const r3=4
const r4=8
const r5=16
const r6=32
const r7=64
const r8=128
dim i,total,includes,properly,compatible As UInt64
for i=0 to 255
  if BitwiseAnd(i,r1+r2+r3)=0 or BitwiseAnd(i,r3+r4+r5)=0 then Continue // at least one of r1, r2 or r3, and r3, r4, r5 must be present to ensure A and B have content
  total=total+1
  if BitwiseAnd(i,r3+r2+r4+r5+r8)=r3 then includes=includes+1 // r3 must be present and r2, r4, r5, r8 must be absent for A to include B
  if BitwiseAnd(i,r3+r2+r4+r5+r8)=r3 and (BitwiseAnd(i,r1)=r1 or BitwiseAnd(i,r6+r7)=r6+r7) then properly=properly+1 // r3 must be present and r4, r5, r6, r7 must be absent and r1 or (r6 and r7) must be present for A to include B
  if BitwiseAnd(i,r2)=0 and BitwiseAnd(i,r4)=0 then compatible=compatible+1 // r2 and r4 must be absent for compatibility
next
print "total="+str(total)+"  includes="+str(includes)+"  (properly="+str(properly)+")  compatible="+str(compatible)